# -*- coding: utf-8 -*-
"""
Created on  2021/2/3 13:45
@author: iris.wang
@file  :  output.py
"""

import requests, logging
import base.globalvars as glo


def get_das_output_info(fileId,mappingId,includeTrace=True):
    """获取das输出接口结果

    :param fileId: 文件Id
    :param mappingId: 模板Id
    :param includeTrace: 是否包含trace

    :return:返回das输出结果
    """
    try:
        das_output_url = glo.get_value(
            "url3") + '/api/v1/das/public/output/coa?dasFileId=%s&coaMappingId=%s&includeTrace=%s' % (
                         fileId, mappingId, includeTrace)
        output_res = requests.get(das_output_url, headers=glo.get_value("header2"))
        output_info = output_res.json()
        return output_info
    except Exception as e:
        logging.error("das输出接口请求失败：%s" % e)
        return None
